home *** CD-ROM | disk | FTP | other *** search
- #
- # A file pager. A demonstration of how to do something useful in ircII.
- # This cheesy rip-off was written by hop in 1996.
- # My apologies in advance to archon.
- # Modified on Jan 25, 1999 as an example of how to use arglists.
- #
-
- alias less (file default "-help")
- {
- @ winnum = winnum()
- if (file == [-help]) {
- xecho -w $winnum Usage: /less <filename>
- } elsif (fexist($file) == 1) {
- less_file $open($file R) ${winsize() - 1} $winnum
- } else {
- xecho -w $winnum $file\: no such file.
- }
- }
-
-
- alias less_file (file, count, winnum default 0, void)
- {
- ^local line 0
- ^local ugh
-
- while (!eof($file) && (line++ < count))
- {
- @ ugh = read($file)
- if (!eof($file)) {
- xecho -w $winnum $ugh
- }
- }
-
- if (!eof($file))
- {
- @ less.fd = file
- @ less.nl = count
- @ less.w = winnum
- input_char "Enter q to quit, or anything else to continue "
- {
- if ([$0] != [q]) {less_file $less.fd $less.nl $less.w}
- }
- }
- {
- @ close($file)
- }
- }
-
- #hop'96,99
-